﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PeopleImport.ascx.cs"
    Inherits="SERP.Modules.People.PeopleImport" %>
<%@ Register Assembly="DateTimePicker" Namespace="DateTimePicker" TagPrefix="cc1" %>
<%@ Register Src="~/Modules/HRM/Organizations/DropDownListOrganizations.ascx" TagName="DropDownListOrganizations"
    TagPrefix="Organizations" %>
<%@ Register Src="~/Modules/HRM/PersonTypes/DropDownListPersonTypes.ascx" TagName="DropDownListPersonTypes"
    TagPrefix="PersonTypes" %>
<%@ Register Src="../Organizations/OrganizationsTree.ascx" TagName="OrganizationsTree"
    TagPrefix="uc1" %>
<%@ Register Src="../../../Controls/FileUpload.ascx" TagName="FileUpload" TagPrefix="uc2" %>
<div class="ftitle">
    <span id="lblTitle" runat="Server" enableviewstate="false"></span>
</div>
<asp:MultiView runat="server" ID="mvImp" ActiveViewIndex="0">
    <asp:View runat="server">
        <script src="Scripts/swfupload.js"></script>
        <script src="Scripts/jquery-asyncUpload-0.1.js"></script>
        <div class="form" id="dvsPeople">
            <div class="fgroup">
                <asp:Label ID="lblInput" runat="server" Text="Input information" Width="400" CssClass="label"
                    EnableViewState="False"></asp:Label>
            </div>
            <div class="frow">
                <asp:Label ID="lblFile" runat="server" Text="File" CssClass="label" EnableViewState="False"></asp:Label>
                <uc2:FileUpload ID="txtFile" runat="server" Width="332" />
                <asp:Button Text="Upload" ID="btnUpload" runat="server" OnClick="btnUpload_Click" />
                <asp:HiddenField runat="server" ID="txtFileName" />
                <asp:Label ID="lblSheet" runat="server" Text="Sheet" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtSheet" AutoPostBack="true" Width="100" OnSelectedIndexChanged="txtSheet_SelectedIndexChanged">
                </asp:DropDownList>
            </div>
            <div class="frow">
                <asp:Label ID="labelPersonCode" runat="server" Text="PersonCode" CssClass="label"
                    EnableViewState="False"></asp:Label>
                <asp:DropDownList ID="txtPersonCode" runat="server" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelFullName" runat="server" Text="FullName" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtFullName" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelGender" runat="server" Text="Gender" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtGender" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelBirthDay" runat="server" Text="BirthDay" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtBirthDay" Width="100">
                </asp:DropDownList>
            </div>
            <div class="frow">
                <asp:Label ID="labelAddress" runat="server" Text="Address" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtAddress" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelPhone" runat="server" Text="Phone" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtPhone" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelEmail" runat="server" Text="Email" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtEmail" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelPositionId" runat="server" Text="PositionId" CssClass="label"
                    EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtPositionId" Width="100">
                </asp:DropDownList>
            </div>
            <div class="frow">
                <asp:Label ID="labelStartDate" runat="server" Text="StartDate" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtStartDate" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelOrganizationId" runat="server" Text="OrganizationId" CssClass="label"
                    EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtOrganizationId" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelPersonTypeId" runat="server" Text="PersonTypeId" CssClass="label"
                    EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtPersonTypeId" Width="100">
                </asp:DropDownList>
                <asp:Label ID="labelNote" runat="server" Text="Note" CssClass="label" EnableViewState="False"></asp:Label>
                <asp:DropDownList runat="server" ID="txtNote" Width="100">
                </asp:DropDownList>
                <asp:Button ID="btnRead" runat="server" CssClass="button" OnClick="btnRead_Click"
                    Text="Read" Width="80px" />
                <asp:Button ID="btnSave" runat="server" CssClass="button" OnClick="btnSave_Click"
                    Text="Save" Width="80px" />
            </div>
            <div class="fgroup">
                <asp:Label ID="lblPreview" runat="server" Text="Preview" Width="400" CssClass="label"
                    EnableViewState="False"></asp:Label>
            </div>
        </div>
        <div>
            <div id="dvTree" style="overflow: scroll-x; float: left; width: 200px; height: 100%;
                border-right: 1px solid #f8f8f8">
                <uc1:OrganizationsTree ID="tv" runat="server" OnSelectedNodeChanged="tv_SelectedNodeChanged" />
            </div>
            <div id="dvGrid" style="float: left; width: 400px">
                <table class="grid">
                    <tr>
                        <td class="tblhleft" style="width: 34px">
                            <input type="checkbox" id="cbkCheckAllPeople" name="cbkCheckAllPeople" onclick="SelectAllCheckboxes(this,'cbkPeople')"
                                onchange="selectAllCheckboxes(this,'cbkPeople')">
                        </td>
                        <td class="tblh" style="width: 34px">
                            <%=SERP.Constants.APP_INDEX%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.PersonCode%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.FullName%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.Address%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.Phone%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.Email%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.Gender%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.BirthDay%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.OrganizationId%>
                        </td>
                        <td class="tblh">
                            <%=SERP.StringMappings.PeopleStringMapping.PersonTypeId%>
                        </td>
                    </tr>
                    <asp:Repeater runat="server" ID="gridData">
                        <ItemTemplate>
                            <tr>
                                <td class="tblcleft">
                                    <asp:CheckBox ID="cbkPeople" runat="server" />
                                </td>
                                <td class="tblc">
                                    <%#Container.ItemIndex+1%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("PersonCode")%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("FullName")%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("Address")%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("Phone")%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("Email")%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("Gender")%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("BirthDay")%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("OrganizationName")%>
                                </td>
                                <td class="tblc">
                                    <%#Eval("PersonTypeName")%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </table>
            </div>
        </div>
        <script type="text/javascript">
            wnd_sizechanged = function (width, height) {
                var dvsPeople = document.getElementById("dvsPeople");
                var dvTree = document.getElementById("dvTree");
                var dvGrid = document.getElementById("dvGrid");
                //dvTree.style.minHeight = (height - 40 - dvsPeople.offsetHeight) + "px";
                dvGrid.style.minHeight = (height - 40 - dvsPeople.offsetHeight) + "px";
                dvGrid.style.width = (width - dvTree.offsetWidth - 2) + "px";
            }
            listenOnSizeChanged(wnd_sizechanged); 
        </script>
    </asp:View>
    <asp:View runat="server">
        <div class="msg">
            <%=SERP.Constants.APP_PROCESS_MESSAGE%>
            &quot;<%=SERP.Constants.APP_EDIT_TITLE%>&quot;
            <%=SERP.StringMappings.PeopleStringMapping.People%>
            <asp:Label ID="lblInfo" runat="server" EnableViewState="False"></asp:Label>
        </div>
        <div class="btnbar">
            <asp:Button ID="btnOK" runat="server" Text="OK" OnClick="OnCancel" />
        </div>
    </asp:View>
</asp:MultiView>
